<?php

namespace Admin\Controller;

use Think\Controller;

class IndexController extends Controller
{

    //布局和颜色图标
    public function index()
    {

       echo 'index';
    }


    public function test(){

        $pic =ROOT_DIR. "Uploads/2017-09-07/59b0bafa3ce21.jpg";

        $image = new \Think\Image();
        if(file_exists($pic)){

            $image->open($pic);
            $width = $image->width(); // 返回图片的宽度
            $height = $image->height(); // 返回图片的高度

            $item = [];
//            $item['title'] = $width.'-'.$height;
//            $item['index_image_raw_height'] = $height;
            $item['title'] = 'w:' . $width . ';h:' . $height;
            M("Article")->where(array('id'=>69499))->save($item);

        }
    }

    /**
     * 敏感词
     * zhouchao@tobosu.cn
     */
    public function mingan(){

        header('content-type:text/html;charset=utf-8');
        $input = "utf-8编码时，如何正则匹配中文汉字？";
        $input = "utf-8我们中间是豪赌世界中新如何";
        $rex = "/中文|如何/u";
        if (preg_match_all($rex, $input, $match)) {
            var_dump($match);
            print("该字符串含有中文");
        } else {
            print("该字符串没有中文");
        }
    }

    


}